<?php
/**
 * @author Andriy
 */
class Registry
{
    
    protected static $_instance = null;

    protected $_registry = array();

    public static function getInstance()
    {
        if( self::$_instance === null )
        {
            self::$_instance = new self;
        }
        return self::$_instance;
    }

    public function  __set($name, $value)
    {
        $this->_registry[$name] = $value;
    }

    public function  __get($name)
    {
        if( !isset( $this->_registry[$name] ) )
        {
            throw new Core_Exception( "No value by key: " . $name . " in class " . get_class( $this ) );
        }
        return $this->_registry[$name];
    }

}